package IOC.C2_resources.C2_3_resourcesImplementations.C2_3_3_resourcesImplementationsFilesystemresource;

import org.junit.Test;
import org.springframework.core.io.FileSystemResource;

import java.io.File;

/**
 * @author xufy
 * @version 1.0
 **/
public class FileSystemResourceTest {

    //implementation for java.io.File handles. It also supports java.nio.file.Path
    //FileSystemResource supports resolution as a File and as a URL.
    // url  uri区别： https://m.php.cn/article/413616.html

    @Test
    public void loadAndReadUrlResource() throws Exception {

        String path = "D:\\StudyProject\\spring-5.3.9-learning\\spring-core\\src\\main\\java\\IOC\\C2_resources\\C2_3_resourcesImplementations\\C2_3_1_resourcesImplementationsUrlresource\\books.xml";
        FileSystemResource resource = new FileSystemResource(path);
        // 获取文件名
        System.out.println("================ resource.getFileName = " + resource.getFilename());
        File file = new File("www.baidu.com");
        System.out.println(file.getName());
    }
}
